﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RecruitStudents.Utility;
using RecruitStudents.Utility.Json;
using RecruitStudents.Utility.Model;

namespace RecruitStudents.Client.BLL
{
    class ServiceAppointment
    {
        WS_Appointment.AppointmentService appointmentService = new WS_Appointment.AppointmentService();
        WS_Appointment.MySoapHeader objHeader = new WS_Appointment.MySoapHeader();
        internal ServiceAppointment()
        {
            objHeader.Username = "admin";
            objHeader.Password = "xy";
            appointmentService.MySoapHeaderValue = objHeader;
        }
        public DataTable GetCheckStudentAppointmentDataTable_First_New(string idCard, string examPlace, string examLevel, string strExamYear)
        {
            DataTable dt = appointmentService.GetCheckStudentAppointmentDataTable_First_New(idCard, examPlace, examLevel, strExamYear).ToDataTable();
            if (dt != null)
            {
                dt.Columns.Add("IsSelect", typeof(bool));
                foreach (DataRow dr in dt.Rows)
                {
                    dr["IsSelect"] = true;
                }
            }
            return dt;
        }

        public DataSet GetStudentAppointmentDataTable_Print(string idCard, string examPlace, string specialityKindsNo, string examLevel, string strExamYear)
        {
            return appointmentService.GetStudentAppointmentDataTable_Print(idCard, examPlace, specialityKindsNo, examLevel, strExamYear);
        }


        public DataTable GetAppointmentStudentDataTable_First_New(string examPlaceNo, string specialityKindsNo, string examLevel, string strExamYear, string strName, string strIdCard_Query)
        {
            return appointmentService.GetAppointmentStudentDataTable_First_New(examPlaceNo, specialityKindsNo, examLevel, strExamYear, strName, strIdCard_Query).ToDataTable();
        }

        public DataTable CheckStudentAppointmentDataTable_First_New(string idCard, string examPlace, string specialityKindsNo, string examLevel, string strExamYear)
        {
            return appointmentService.CheckStudentAppointmentDataTable_First_New(idCard, examPlace, specialityKindsNo, examLevel, strExamYear).ToDataTable();
        }

        public JsonMessage MakeAppointment_First_New(string strSignUpID, string strExamPlaceNO, string strSpecNo, string strExamLevel, string strExamYear)
        {
            return appointmentService.MakeAppointment_First_New(strSignUpID, strExamPlaceNO, strSpecNo, strExamLevel, strExamYear).ToList<JsonMessage>();
        }




        #region First
        public JsonMessage SaveAppointmentIdCard_First(string strSignupID, string strPicData)
        {
            return appointmentService.SaveAppointmentIdCard_First(strSignupID, strPicData).ToList<JsonMessage>();
        }

        public TB_Sys_ExamPlaceSpecialityKindsGroupMapping GetAppointmentGroupTypeName_First(string strGroupNO)
        {
            return appointmentService.GetAppointmentGroupTypeName_First(strGroupNO).ToList<TB_Sys_ExamPlaceSpecialityKindsGroupMapping>();
        }


        /// <summary>
        /// 获取考点-专业-考试时间映射表（分组）信息
        /// </summary>
        /// <param name="examPlaceNo"></param>
        /// <param name="specialityKindsNo"></param>
        /// <param name="examLevel"></param>
        /// <returns></returns>
        public DataTable GetAppointmentTypeDataTable_First(string examPlaceNo, string specialityKindsNo, string examLevel)
        {
            return appointmentService.GetAppointmentTypeDataTable_First(examPlaceNo, specialityKindsNo, examLevel).ToDataTable();
        }
        /// <summary>
        /// 获取组内学生
        /// </summary>
        /// <param name="examPlaceSpecialityKindsExamTimeMappingId"></param>
        /// <param name="examPlaceNo"></param>
        /// <param name="specialityKindsNo"></param>
        /// <param name="examLevel"></param>
        /// <returns></returns>
        public DataTable GetAppointmentStudentDataTable_First(string strGroupNo, string examPlaceNo, string specialityKindsNo, string examLevel)
        {
            return appointmentService.GetAppointmentStudentDataTable_First(strGroupNo, examPlaceNo, specialityKindsNo, examLevel).ToDataTable();
        }

        public DataTable CheckStudentAppointmentDataTable_First(string idCard, string examPlace, string specialityKindsNo, string examLevel)
        {
            return appointmentService.CheckStudentAppointmentDataTable_First(idCard, examPlace, specialityKindsNo, examLevel).ToDataTable();
        }

        public JsonMessage MakeAppointment_First(string strSignUpStudentsSpecialityID, string strGroupNo)
        {
            return appointmentService.MakeAppointment_First(strSignUpStudentsSpecialityID, strGroupNo).ToList<JsonMessage>();
        }

        public JsonMessage CancelAppointment_First(string strSignUpStudentsSpecialityID, string strGroupNo)
        {
            return appointmentService.CancelAppointment_First(strSignUpStudentsSpecialityID, strGroupNo).ToList<JsonMessage>();
        }
        #endregion

        #region Second
        public DataTable GetAppointmentStudentDataTable_Second(string strGroupNo, string examPlaceNo, string specialityKindsNo, string examLevel)
        {
            return appointmentService.GetAppointmentStudentDataTable_Second(strGroupNo, examPlaceNo, specialityKindsNo, examLevel).ToDataTable();
        }

        public DataTable CheckStudentAppointmentDataTable_Second(string strIdCard, string strExamPlaceID, string strSpecialityKindsNO, string strExamLevel)
        {
            return appointmentService.CheckStudentAppointmentDataTable_Second(strIdCard, strExamPlaceID, strSpecialityKindsNO, strExamLevel).ToDataTable();
        }

        public JsonMessage MakeAppointment_Second(string strSignUpStudentsSpecialityID, string strGroupNo)
        {
            return appointmentService.MakeAppointment_Second(strSignUpStudentsSpecialityID, strGroupNo).ToList<JsonMessage>();
        }

        public JsonMessage SaveAppointmentIdCard_Second(string signupid, string strPicData)
        {
            return appointmentService.SaveAppointmentIdCard_Second(signupid, strPicData).ToList<JsonMessage>();
        }

        public JsonMessage CancelAppointment_Second(string strSignUpStudentsSpecialityID, string strGroupNo)
        {
            return appointmentService.CancelAppointment_Second(strSignUpStudentsSpecialityID, strGroupNo).ToList<JsonMessage>();
        }
        #endregion

    }
}
